<?php


namespace app\common\lib\redEnvelopes;

/**
 * 普通红包
 * @package app\api\service
 *
 * @Author: Li Guo Xin <guoxinlee129@gmail.com>
 * @Date: 2020/4/17
 * @Time: 22:11
 */
class OrdinaryRedEnvelope implements RedEnvelopes
{
    const TYPE = 'ordinary';
    private $single_amount = 0.01;#单个红包的金额
    private $number = 1;#红包个数

    /**
     * @inheritDoc
     */
    public function generate($single_amount, $number)
    {
        // TODO: Implement generate() method.
        //普通红包
        //总金额(缺省) = 单个红包的金额 * 红包个数
        $total_amount = $single_amount * $number;
        if ($total_amount < 0.01 || $total_amount > 20000) {
            throw new \Exception('红包信息有误');
        }
    }

    /**
     * @inheritDoc
     */
    public function checkStock($red_envelopes_id, $user_id)
    {
        // TODO: Implement checkStock() method.
    }

    /**
     * @inheritDoc
     */
    public function rob($red_envelopes_id, $user_id)
    {
        // TODO: Implement rob() method.
    }
}